<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="/static/css/reset.css">
    <link rel="stylesheet" href="/static/css/index.css">
    <style>
        html,
        body {
            width: 100%;
            height: 100%
        }

        .fr {
            float: right;
        }

        .w100 {
            width: 100%;
        }

        .h100 {
            height: 100%;
        }

        .bc {
            background-color: rgb(84, 92, 100);
        }

        .el-header {
            padding: 0;
        }

        .html-title {
            font-size: 24px;
        }

        .dialog-footer {
            width: 300px;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div id="app">

        <h3 class="html-title">添加店铺</h3>

        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
            <el-tab-pane label="商家信息" name="first">
                <el-form :model="form">
                    <el-form-item label="店铺名称" :label-width="formLabelWidth">
                        <el-input v-model="form.name" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="姓名" :label-width="formLabelWidth">
                        <el-input v-model="form.name" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="电话1" :label-width="formLabelWidth">
                        <el-input v-model="form.name" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="电话2" :label-width="formLabelWidth">
                        <el-input v-model="form.name" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="营业时间" :label-width="formLabelWidth">
                        <el-col :span="4">
                            <el-time-picker type="fixed-time" placeholder="开门时间" v-model="form.date2" style="width: 100%;"></el-time-picker>
                        </el-col>
                        <el-col class="line" :span="1">&nbsp;</el-col>
                        <el-col :span="4">
                            <el-time-picker type="fixed-time" placeholder="打佯时间" v-model="form.date2" style="width: 100%;"></el-time-picker>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="地址" :label-width="formLabelWidth">
                        <el-input v-model="form.address" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="商家要求" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                    <el-form-item label="运营要求" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                </el-form>
            </el-tab-pane>
            <el-tab-pane label="合作信息" name="second">
                <el-form :model="form">

                    <el-form-item label="签约日期" :label-width="formLabelWidth">
                        <el-date-picker v-model="value1" type="date" placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="服务时间" :label-width="formLabelWidth">
                        <el-date-picker v-model="value1" type="date" placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="美团" :label-width="formLabelWidth">
                        <el-col :span="4">
                            <el-select v-model="form.head_id" placeholder="合作模式">
                                <el-option label="茅开彬" value="11"></el-option>
                                <el-option label="康昌铭" value="12"></el-option>
                            </el-select>
                        </el-col>
                        <el-col :span="6">
                            <el-input v-model="form.name" auto-complete="off">
                                <template slot="prepend">账号</template>
                            </el-input>
                        </el-col>
                        <el-col :span="6">
                            <el-input v-model="form.name" auto-complete="off">
                                <template slot="prepend">密码</template>
                            </el-input>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="备注" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                    <el-form-item label="饿了吗" :label-width="formLabelWidth">
                        <el-col :span="4">
                            <el-select v-model="form.head_id" placeholder="合作模式">
                                <el-option label="茅开彬" value="11"></el-option>
                                <el-option label="康昌铭" value="12"></el-option>
                            </el-select>
                        </el-col>
                        <el-col :span="6">
                            <el-input v-model="form.name" auto-complete="off">
                                <template slot="prepend">账号</template>
                            </el-input>
                        </el-col>
                        <el-col :span="6">
                            <el-input v-model="form.name" auto-complete="off">
                                <template slot="prepend">密码</template>
                            </el-input>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="备注" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                </el-form>
            </el-tab-pane>
            <el-tab-pane label="运营团队" name="third">
                <el-form :model="form">
                    <el-form-item label="主策划" :label-width="formLabelWidth">
                        <el-select v-model="form.head_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="运营" :label-width="formLabelWidth">
                        <el-select v-model="form.head_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="客服" :label-width="formLabelWidth">
                        <el-select v-model="form.service_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="美工" :label-width="formLabelWidth">
                        <el-select v-model="form.service_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="市场" :label-width="formLabelWidth">
                        <el-select v-model="form.head_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="财务" :label-width="formLabelWidth">
                        <el-select v-model="form.head_id" placeholder="负责人">
                            <el-option label="茅开彬" value="11"></el-option>
                            <el-option label="康昌铭" value="12"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
            </el-tab-pane>
            <el-tab-pane label="运营计划" name="fourth">
                <el-button type="primary" @click="dialogAddPlan = true">添加运营计划</el-button>
                <el-table :data="tableData2" style="width: 100%">
                    <el-table-column prop="date" label="日期" width="180">
                    </el-table-column>
                    <el-table-column prop="address" label="美团计划">
                    </el-table-column>
                    <el-table-column prop="address" label="饿了吗计划">
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-dialog title="添加运营计划" :visible.sync="dialogAddPlan">
                <el-form :model="form">
                    <el-form-item label="美团运营计划" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                    <el-form-item label="饿了吗运营计划" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogAddPlan = false">取 消</el-button>
                    <el-button type="primary" @click="addShop">确 定</el-button>
                </div>
            </el-dialog>
            <el-tab-pane label="店铺跟踪" name="fifth">
                <el-button type="primary" @click="dialogAddTrace = true">添加店铺跟踪</el-button>
                <el-table :data="tableData2" style="width: 100%">
                    <el-table-column prop="date" label="日期" width="180">
                    </el-table-column>
                    <el-table-column prop="address" label="美团计划">
                    </el-table-column>
                    <el-table-column prop="address" label="饿了吗计划">
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-dialog title="添加店铺跟踪" :visible.sync="dialogAddTrace">
                <el-form :model="form">
                    <el-form-item label="美团运营计划" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                    <el-form-item label="饿了吗运营计划" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="form.content"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogAddTrace = false">取 消</el-button>
                    <el-button type="primary" @click="addShop">确 定</el-button>
                </div>
            </el-dialog>
        </el-tabs>

        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="addShop">确 定</el-button>
        </div>
    </div>

</body>
<script src="/static/js/dbkj.js"></script>
<script src="/static/js/vue.js"></script>
<!-- 引入组件库 -->
<script src="/static/js/index.js"></script>
<script src="/static/js/axios.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        mounted() {
            this.loadData();
        },
        data() {
            return {
                activeName: 'first',
                form: {
                    name: "",
                    platform: "",
                    address: "",
                    head_id: "",
                    service_id: "",
                    style: "",
                    content: ""
                },
                tableData: [{
                    name: '1',
                    platform: '王小虎',
                    address: '上海',
                    head_id: "会员",
                    service_id: '一个小会员',
                    style: "182.123.123.123",
                    content: "1233"
                }],
                dialogFormVisible: false,
                formLabelWidth: '120px',
                dialogImageUrl: '',
                dialogVisible: false,
                tableData2: [{
                    date: '2016-05-02',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄'
                }, {
                    date: '2016-05-04',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1517 弄'
                }, {
                    date: '2016-05-01',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1519 弄'
                }, {
                    date: '2016-05-03',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1516 弄'
                }],
                // 运营计划
                dialogAddPlan:false,
                //店铺跟踪
                dialogAddTrace:false
            }
        },
        methods: {
            loadData() {
                this.getShop();
            },
            showDialog() {
                this.dialogFormVisible = !this.dialogFormVisible;
            },
            // 切换事件
            handleClick() {

            },
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
            handlePictureCardPreview(file) {
                this.dialogImageUrl = file.url;
                this.dialogVisible = true;
            },
            //获取管理员
            getShop() {
                let _this = this;
                axios.get('get_shop')
                    .then(res => {
                        console.log(res);
                        _this.tableData = res.data;
                    })
                    .catch(err => {

                    })
            },
            //添加店铺
            addShop() {
                let data = this.form;
                let _this = this;
                axios.post('add_shop', data)
                    .then(res => {
                        _this.dialogVisible = true;
                        _this.$message({
                            message: res.data.msg,
                            type: 'success'
                        });
                        _this.dialogVisible = false;
                    })
                    .catch(err => {
                        _this.$message({
                            message: err.data.msg,
                            type: 'error'
                        });
                    })
            }
        }
    })
</script>

</html>